<?php
namespace Home\Controller;
use Think\Controller;
class CommonController extends Controller {

	protected $_loginStatus = array();

    public function  _initialize(){
		// exit;
	}
	
	public function uId(){
		return I('session.user_id',null);
	}

	public function doLogin($user_id){
		$_SESSION['is_login'] = true;
		$_SESSION['user_id'] = $user_id;
		setcookie("user_id",I('session.user_id'),time()+3600*24*7,"/",C('COOKIE_DOMAIN'));
	}

	public function doLogout(){
		cookie('user_id', NULL);
		session_destroy();
	}

	public function checkLogin(){
		if($_SESSION['is_login'] == true){
			return true;
		}else{
			return false;
		}
	}
}